﻿
using OpenCvSharp;

using Xc.DataAccess.CodeReader.Properties;
using Xc.DataAccess.Core;

namespace Xc.DataAccess.CodeReader.Models.Filters
{
    /// <summary>
    /// 拉普拉斯变换
    /// </summary>
    [Filter("拉普拉斯变换", FilterType.Algorithm)]
    public class AlgorithmLaplacian : FilterBase
    {
        [InputParameter("类型")]
        public MatType MatType { get; set; }
        [InputParameter("KSize")]
        public int KSize { get; set; } = 1;
        [InputParameter("大小")]
        public int Size { get; set; } = 1;
        [InputParameter("Scale")]
        public int Scale { get; set; } = 1;
        [InputParameter("Delta")]
        public double Delta { get; set; } = 0;
        [InputParameter("边框类型")]
        public BorderTypes BorderType { get; set; }
        internal override ResultData<Mat> UseChannel(Mat mat, FilterBase[] filterInfos, FilterBase preFilterBase)
        {
            Mat mat1 = new Mat();
            Cv2.Laplacian(mat, mat1, MatType, KSize, Scale, Delta, BorderType);
            return ResultData<Mat>.Accept(TextResource.filter_action_complete, mat1);
        }
    }
}
